package com.srv.util;

import com.srv.ContentType;

import junit.framework.Assert;
import junit.framework.TestCase;

public class IDGeneratorTestCase extends TestCase {
   public void test_createID(){
	   String id1=IDGenerator.createID();
	   String id2=IDGenerator.createID();
	   Assert.assertNotSame(id1, id2);	   
       Assert.assertEquals(32,id1.length());               
   }
   public void test_createID_array(){
	   String[] id1=IDGenerator.createID(10);
	   String[] id2=IDGenerator.createID(-1);	   	  
       Assert.assertEquals(10,id1.length);
       for(int i=0; i<id1.length;i++){
    	   Assert.assertEquals(32,id1[i].length());
       }
       Assert.assertNull(id2);  
   }
   public void test_isValid(){
	   String id1=IDGenerator.createID();	   	     
       Assert.assertEquals(true,IDGenerator.isValid(id1));
       Assert.assertEquals(false,IDGenerator.isValid(null)); 
       Assert.assertEquals(false,IDGenerator.isValid("aaa"));
   }
}
